?><?

function getmicrotime(){ 
  list($usec, $sec) = explode(" ",microtime()); 
  return ((float)$usec + (float)$sec); 
}

function StartTimer($name){global $$name;$$name=getmicrotime();}
function setTimer($name){return StartTimer($name);}
function getTimer($name){global $$name;return round((getmicrotime()-$$name)*1000);}

StartTimer("stime");

function asdate($value,$sep='-'){
  $date=substr($value,0,11);  
  list($year,$month, $day) = explode($sep, $date);
  if($year!=0){
    return date('d'.$sep.'m'.$sep.'Y',mktime(0,0,0,$month,$day,$year));    
  }else{
    return "00-00-0000";
  }
}

function asdateandtime($value,$sep='-'){
  $date=substr($value,0,11);
  list($year,$month, $day) = explode($sep, $date);
  return date('d'.$sep.'m'.$sep.'Y',mktime(0,0,0,$month,$day,$year)).substr($value,10,15);
}

function asdateandtime_wm($value,$sep='-'){
  $date=substr($value,0,11);
  list($year,$month, $day) = explode($sep, $date);
  return date('d'.$sep.'M'.$sep.'Y',mktime(0,0,0,$month,$day,$year)).substr($value,10,15);
}

function split_date($value,&$year,&$month,&$day,$sep='-'){
  $date=substr($value,0,10);
  list($year,$month, $day) = explode($sep, $date);  
}

function extYear($date,$sep='-'){
  list($year,$month,$day)=explode($sep,$date);
  return $year;
}
function extTime($value,$sep=' '){
  list($date,$time)=explode($sep,$value);
  return substr($time,0,5);
}